Improve import scanning performance on app dev#6930
Improve import scanning performance on app dev#6930gonzaloriestra wants to merge 2 commits intomainfrom
Conversation
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260303123133Caution After installing, validate the version by running |
Coverage report
Test suite run success3792 tests passing in 1451 suites. Report generated by 🧪jest coverage report action from 013a52a |
51fc769 to
2aa31b8
Compare
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260304084414Caution After installing, validate the version by running |
2aa31b8 to
013a52a
Compare
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/constants.d.ts@@ -32,6 +32,7 @@ export declare const environmentVariables: {
neverUsePartnersApi: string;
skipNetworkLevelRetry: string;
maxRequestTimeForNetworkCalls: string;
+ disableImportScanning: string;
};
export declare const defaultThemeKitAccessDomain = "theme-kit-access.shopifyapps.com";
export declare const systemEnvironmentVariables: {
packages/cli-kit/dist/public/node/import-extractor.d.ts@@ -1,6 +1,12 @@
+/**
+ * Clears all import-scanning caches (direct imports, recursive results, and filesystem stats).
+ * Should be called when watched files change so that rescanning picks up updated imports.
+ */
+export declare function clearImportPathsCache(): void;
/**
* Extracts import paths from a source file.
* Supports JavaScript, TypeScript, and Rust files.
+ * Results are cached per file path to avoid redundant I/O.
*
* @param filePath - Path to the file to analyze.
* @returns Array of absolute paths to imported files.
@@ -17,6 +23,17 @@ export declare function extractImportPaths(filePath: string): string[];
* @throws If an unexpected error occurs while processing files (not including ENOENT file not found errors).
*/
export declare function extractImportPathsRecursively(filePath: string, visited?: Set<string>): string[];
+/**
+ * Returns diagnostic information about the import scanning caches.
+ * Useful for debugging performance issues with --verbose.
+ *
+ * @returns Cache size stats for directImports, fileExists, and isDir.
+ */
+export declare function getImportScanningCacheStats(): {
+ directImports: number;
+ fileExists: number;
+ isDir: number;
+};
/**
* Extracts import paths from a JavaScript content.
*
|
WHY are these changes introduced?
Fixes https://github.com/shop/issues-develop/issues/21853
WHAT is this pull request doing?
How to test your changes?
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist